package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Setter
@Getter
public class StrategyComment extends BaseDomain {

    private User user;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    private String content;

    private String imgUrls;

    private Integer starNum = 1;

    private Strategy strategy;

    private Integer state;

    private Date commendTime;

    private Integer commentNum;

    public String[] getImgUrlsArr() {
        if (imgUrls != null) {
            return imgUrls.split(";");
        }
        return null;
    }

    //回显星星
    public String getStar() {
        String temp = "";
        for (int i = 0; i < 5; i++) {
            if (i < starNum) {
                temp += " <i class=\"fa fa-star\"></i>";
            } else {
                temp += " <i class=\"fa fa-star-o\"></i>";
            }
        }
        return temp;
    }
    public String[] toImgUrlsArray(){
        String[] arr = {};
        if (imgUrls != null){
            return imgUrls.split(";");
        }
        return arr;
    }

}